export const delObjInArr = (arr,obj) => {
   let i = getIndexInArr(arr,obj)
    if(i === -1)return
    arr.splice(i,1);
}

//从数组中获取对象的索引
function getIndexInArr(_arr,_obj) {
    let len = _arr.length;
    for(let i = 0; i < len; i++)
    {
        if(isObjectValueEqual(_arr[i],_obj)) {
            return i;
        }
    }
    return -1;
}


//判断对象是否相等
function isObjectValueEqual(a, b) {
    if(typeof(a) != "object" && typeof(b) != "object"){
        if(a == b){
            return true;
        }else{
            return false;
        }
    }
    let aProps = Object.getOwnPropertyNames(a);
    let bProps = Object.getOwnPropertyNames(b);

    if (aProps.length != bProps.length) {
        return false;
    }

    for (let i = 0; i < aProps.length; i++) {
        let propName = aProps[i];

        if (a[propName] !== b[propName]) {
            return false;
        }
    }

    return true;
}

